import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';

import 'jdunion_plugin_platform_interface.dart';

/// An implementation of [JdunionPluginPlatform] that uses method channels.
class MethodChannelJdunionPlugin extends JdunionPluginPlatform {
  /// The method channel used to interact with the native platform.
  @visibleForTesting
  final methodChannel = const MethodChannel('jdunion_plugin');

  @override
  Future<String?> getPlatformVersion() async {
    final version = await methodChannel.invokeMethod<String>('getPlatformVersion');
    return version;
  }

  @override
  Future<void> initJdUnion(String version) async {
     await methodChannel.invokeMethod<String>('initJdUnion', version);
  }

  @override
  Future<dynamic> openJDAppByUrl(String url) async {
    return await methodChannel.invokeMethod<dynamic>('openJDAppByUrl', url);
  }

  @override
  Future<dynamic> openJXAppByUrl(String url) async {
    return await methodChannel.invokeMethod<dynamic>('openJXAppByUrl', url);
  }
}
